home *** CD-ROM | disk | FTP | other *** search
- /* $VER: SelectedReply2Enter.thor v1.00 (28.02.95)
- *
- * Convert a selected reply event on a bbs to an enter event.
- *
- * Script by: Troels Walsted Hansen with 99% code ripped from
- * Reply2Enter.br by Eivind Nordseth, Ultima Thule Software.
- *
- */
-
- options results
-
- EVE_ENTERMSG = 0 /* Enter message */
- EVE_REPLYMSG = 1 /* Reply message */
-
- EDF_DELETED = '00000001'x /* Event is deleted */
- EDF_DONE = '00000004'x /* Event is done */
- EDF_ERROR = '00000008'x /* Error performing this event */
- EDF_FREEZE = '00000020'x /* Event is frozen. Will not be done as long as this flag is set. */
-
- /* needs THOR and bbsread.library functions */
-
- p = ' ' || address() || ' ' || show('P',,)
- thorport = pos(' THOR.',p)
-
- if thorport > 0 then thorport = word(substr(p,thorport+1),1)
- else
- do
- say 'No THOR port found!'
- exit 10
- end
-
- if ~show('p', 'BBSREAD') then do
- address command
- "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
- "WaitForPort BBSREAD"
- end
-
- /* get current BBS and current selected eventnumber */
-
- address(thorport)
- CURRENTBBS stem CURRENT
- GETSELECTEDEVENT
- n = result
-
- address(bbsread)
- READBREVENT '"'CURRENT.BBSNAME'"' eventnr n datastem EVENTDATA tagsstem EVENTTAGS
- if(rc ~= 0) then
- do
- address(thorport)
- REQUESTNOTIFY '"'BBSREAD.LASTERROR'"' '"Abort"'
- exit
- end
-
- if EVENTDATA.EVENTTYPE == EVE_REPLYMSG then
- do
- if bitand(EVENTDATA.FLAGS, bitor(bitor(bitor(EDF_DELETED, EDF_DONE), EDF_ERROR), EDF_FREEZE)) = '00000000'x then
- do
- WRITEBREVENT '"'CURRENT.BBSNAME'"' event EVE_ENTERMSG stem EVENTTAGS updateeventnr n
- if(rc ~= 0) then
- do
- address(thorport)
- REQUESTNOTIFY '"'BBSREAD.LASTERROR'"' '"Abort"'
- exit
- end
- end
- end
-